# 登录断言工具
def assert_longin(res, exp, exp1, exp2, exp3):
    assert res.status_code == exp
    assert res.json()["success"] == exp1
    assert res.json()["code"] == exp2
    assert exp3 in res.json()["message"]


# 添加员工断言
def assert_add(res, exp, exp1, exp2, exp3, exp4, ):
    assert res.status_code == exp
    assert res.json()["success"] == exp1
    assert res.json()["code"] == exp2
    assert exp3 in res.json()["message"]
    if exp4 is not None:
        assert res.json()["data"]["departmentId"] == exp4


# 查询员工断言
def assert_query(res,exp,exp1,exp2,exp3,exp4):
    assert res.status_code == exp
    assert res.json()["success"] == exp1
    assert res.json()["code"] == exp2
    assert exp3 in res.json()["message"]
    assert res.json()["data"]["id"] == exp4


# 修改员工断言
def assert_amend(res_amend, exp, success, code, message, id, username, departmentId, ):
    assert res_amend.status_code == exp
    assert res_amend.json()["success"] == success
    assert res_amend.json()["code"] == code
    assert message in res_amend.json()["message"]
    if id is not None:
        assert res_amend.json["data"]["id"] == id
    if username is not None:
        assert res_amend.json["data"]["username"] == username
    if departmentId is not None:
        assert res_amend.json["data"]["departmentId"] == departmentId


# 删除员工断言
def assert_delete(res, exp, success, code, message):
    assert res.status_code == exp
    assert res.json()["success"] == success
    assert res.json()["code"] == code
    assert message in res.json()["message"]
